import { Suspense } from "react";
import {createBrowserRouter, RouteObject, RouterProvider} from "react-router-dom";
import Layout from "@/Layout/Layout.tsx";
import {routes} from "@/routes/modules";

function CustomRouter() {


  const basicRoute: Array<RouteObject> = [
    {
      path: "/",
      element: <Layout />,
      children: routes,
    },
  ];

   const router = createBrowserRouter(basicRoute);


  return (
    <>
      <Suspense fallback={<div>Loading...</div>}>
        <RouterProvider router={router}></RouterProvider>
      </Suspense>
    </>
  );
}

export default CustomRouter;
